package org.september.pisces.settings;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.september.pisces.module.api.PiscesModule;
import org.september.pisces.module.api.WebMenu;
import org.september.pisces.settings.controller.PiscesSettingsController;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;


/**
 * 标注service，用于主工程发现插件模块
 * @author yexinzhou
 *
 */
@Configuration
@ComponentScan(basePackageClasses = SettingsModule.class)
public class SettingsModule implements PiscesModule {

	public static final String 系统配置="系统配置";
	
	private static Map<String,List<WebMenu>> moduleMap = new HashMap<>();
	static {
		List<WebMenu> menus1 = new ArrayList<>();
		menus1.add(new WebMenu("系统配置-配置列表", PiscesSettingsController.List_Page, "layui-icon-component")
				.addPermission("页面", PiscesSettingPermission.系统配置列表.getUrls())
				.addPermission("编辑", PiscesSettingPermission.编辑配置.getUrls()));
		moduleMap.put(系统配置, menus1);
	}
	public static List<WebMenu> getWebMenus(String moduleName) {
		return moduleMap.get(moduleName);
    }
	public SettingsModule(){
		System.out.println(this.getClass().getName()+" init..");
	}

	public String[] getMyBatisMapperLocation() {
		return new String[] {"classpath:"+SettingsModule.class.getPackageName().replace(".", "/")+"/mapper/*.xml"};
	}
	
	public String[] getEntityPackages() {
		return new String[] {SettingsModule.class.getPackageName()+".entity"};
    }
	

}
